<script setup>
import { ref, onMounted } from "vue";
import { User, School } from "@element-plus/icons-vue";

const currentDate = ref(
  new Date().toLocaleDateString("zh-CN", {
    year: "numeric",
    month: "long",
    day: "numeric",
    weekday: "long",
  })
);

const currentTime = ref("");

onMounted(() => {
  updateTime();
  setInterval(updateTime, 1000);
});

function updateTime() {
  currentTime.value = new Date().toLocaleTimeString("zh-CN", {
    hour: "2-digit",
    minute: "2-digit",
    second: "2-digit",
  });
}
</script>

<template>
  <div class="home-container">
    <div class="welcome-section">
      <div class="title-animation">
        <h1>ADMIN UI</h1>
        <p class="subtitle">智能阅读器管理系统</p>
      </div>

      <div class="info-card">
        <div class="datetime-info">
          <p class="date">{{ currentDate }}</p>
          <p class="time">{{ currentTime }}</p>
        </div>
        <div class="welcome-message">
          <h2>欢迎使用管理平台</h2>
          <p>本系统提供校园信息管理、学生数据分析等功能</p>
          <div class="quick-links">
            <el-button type="primary" @click="$router.push('/campus/class')"
              >班级管理</el-button
            >
            <el-button type="success" @click="$router.push('/campus/student')"
              >学生管理</el-button
            >
            <el-button type="info" @click="$router.push('/system/user')"
              >用户管理</el-button
            >
          </div>
        </div>
      </div>
    </div>

    <div class="summary-cards">
      <div class="summary-card">
        <div class="card-icon">
          <el-icon><User /></el-icon>
        </div>
        <div class="card-content">
          <h3>用户管理</h3>
          <p>系统用户的增删改查</p>
        </div>
      </div>

      <div class="summary-card">
        <div class="card-icon">
          <el-icon><School /></el-icon>
        </div>
        <div class="card-content">
          <h3>班级管理</h3>
          <p>班级信息的维护与学生分配</p>
        </div>
      </div>

      <div class="summary-card">
        <div class="card-icon">
          <el-icon><User /></el-icon>
        </div>
        <div class="card-content">
          <h3>学生管理</h3>
          <p>学生信息的维护与班级分配</p>
        </div>
      </div>
    </div>
  </div>
</template>

<style scoped>
.home-container {
  padding: 30px;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.welcome-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 20px;
}

.title-animation {
  text-align: center;
  margin-bottom: 40px;
}

.title-animation h1 {
  font-size: 6rem;
  font-weight: bold;
  margin: 0;
  background: linear-gradient(90deg, #4dabf7 0%, #3b5bdb 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 5px;
  text-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  animation: fadeInDown 1s ease-out forwards;
}

.subtitle {
  font-size: 1.6rem;
  color: #666;
  margin-top: 10px;
  letter-spacing: 2px;
  animation: fadeIn 1.5s ease-out forwards;
}

.info-card {
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  padding: 30px;
  width: 80%;
  max-width: 1000px;
  display: flex;
  animation: fadeIn 1s ease-out forwards;
}

.datetime-info {
  padding-right: 30px;
  border-right: 1px solid #eee;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.date {
  font-size: 1.1rem;
  color: #333;
  margin-bottom: 5px;
}

.time {
  font-size: 1.8rem;
  color: #1890ff;
  font-weight: bold;
}

.welcome-message {
  flex: 1;
  padding-left: 30px;
}

.welcome-message h2 {
  font-size: 2rem;
  color: #333;
  margin-top: 0;
  margin-bottom: 15px;
}

.welcome-message p {
  color: #666;
  font-size: 1.1rem;
  margin-bottom: 25px;
}

.quick-links {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.summary-cards {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.summary-card {
  background-color: white;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
  padding: 25px;
  flex: 1;
  min-width: 250px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  animation: fadeIn 1.5s ease-out forwards;
}

.summary-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.card-icon {
  background-color: #f0f7ff;
  border-radius: 12px;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 20px;
}

.card-icon .el-icon {
  font-size: 28px;
  color: #1890ff;
}

.card-content h3 {
  margin-top: 0;
  margin-bottom: 5px;
  font-size: 1.3rem;
  color: #333;
}

.card-content p {
  margin: 0;
  color: #666;
  font-size: 1rem;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
</style>
